package org.mspring.mlog.security.service;

import java.util.List;
import org.mspring.mlog.dao.RoleTreeItemDao;
import org.mspring.mlog.entity.RoleTreeItem;
import org.mspring.nbee.orm.dao.sql.builder.part.condition.SqlCondition;
import org.mspring.nbee.orm.dao.sql.pager.PageResult;
import org.mspring.nbee.orm.dao.sql.pager.Pager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author Gao Youbo
 * @since 2014-09-10 12:44:49
 */
@Service
public class RoleTreeItemService {

    private static final Logger log = LoggerFactory.getLogger(RoleTreeItemService.class);

    private RoleTreeItemDao roleTreeItemDao;

    public RoleTreeItem findById(long id) {
        return roleTreeItemDao.findById(id);
    }

    public PageResult<RoleTreeItem> list(List<SqlCondition> conditions, Pager pager) {
        return roleTreeItemDao.listPage(conditions, pager);
    }

    @Transactional
    public boolean update(RoleTreeItem roleTreeItem) {
        return roleTreeItemDao.update(roleTreeItem);
    }

    @Transactional
    public boolean deleteById(long id) {
        return roleTreeItemDao.deleteById(id);
    }

    @Autowired
    public void setRoleTreeItemDao(RoleTreeItemDao roleTreeItemDao) {
        this.roleTreeItemDao = roleTreeItemDao;
    }

}